﻿using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using Rhino.Mocks;
using TddGenerator.Core.Domain;
using TddGenerator.Core.Services;
using TddGenerator.Core.Services.Impl;

namespace TddGenerator.UnitTests.Services
{
    [TestFixture]
    public class TemplateSetRepositoryTester
    {
        [Test]
        public void Repository_should_return_the_default_templateset()
        {
            MockRepository mocks = new MockRepository();
            IFileSystemService fileSystemService = mocks.DynamicMock<IFileSystemService>();

            using (mocks.Record())
            {
                fileSystemService.GetDirectoryName("");
                LastCall.IgnoreArguments().Return("");
            }

            using (mocks.Playback())
            {
                ITemplateSetRepository repository = new TemplateSetRepository(fileSystemService);
                TemplateSet set = repository.Get();
                Assert.That(set.ClassTemplate, Is.EqualTo("\\Templates\\Nunit\\ConcreteClassUnderTest.cs"));
                Assert.That(set.FileExtension, Is.EqualTo(".cs"));
                Assert.That(set.InterfaceTemplate, Is.EqualTo("\\Templates\\nunit\\InterfaceUnderTest.cs"));
                Assert.That(set.Language, Is.EqualTo("CSharp"));
                Assert.That(set.TestClass, Is.EqualTo("\\Templates\\nunit\\InterfaceUnderTestTester.cs"));
            }

            mocks.VerifyAll();

        }
    }
}